package com.dbf.site.client.main.view;

import com.google.gwt.user.client.ui.Widget;
import com.mvp4g.client.view.ReverseViewInterface;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.widget.core.client.FramedPanel;
import com.sencha.gxt.widget.core.client.button.TextButton;
import com.sencha.gxt.widget.core.client.container.HorizontalLayoutContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
import com.sencha.gxt.widget.core.client.form.FieldLabel;
import com.sencha.gxt.widget.core.client.form.TextField;
import com.sencha.gxt.widget.core.client.form.FormPanel.LabelAlign;

public class EastView implements IEastView, ReverseViewInterface<IEastView.IEastPresenter>{
	private IEastView.IEastPresenter presenter;
	private FramedPanel container;
	
	private TextField login = new TextField();
	private TextField password = new TextField();
	
	private TextButton loginButton;
	
	public EastView(){
		this.createView();
	}
	private void createView(){
		container = new FramedPanel();
	    container.setHeight("100%");
	    container.setHeaderVisible(false);
	    container.setBodyStyle("background-color:#3892d3;");
	    
	    login.setValue("");
	    VerticalLayoutContainer form = new VerticalLayoutContainer();
	    FieldLabel flLogin = new FieldLabel(login, "login");
	    form.add(flLogin, new VerticalLayoutContainer.VerticalLayoutData(1, 0.05, new Margins(1)));
	    flLogin.setLabelWidth(30);
	    
	    FieldLabel flPassword = new FieldLabel(password, "password");
	    
	    flPassword.setLabelAlign(LabelAlign.LEFT);
	    flPassword.setLabelWidth(60);
	    form.add(flPassword, new VerticalLayoutContainer.VerticalLayoutData(1, 0.05, new Margins(1)));
	    
	    loginButton = new TextButton("Connect");
	    form.add(loginButton, new VerticalLayoutContainer.VerticalLayoutData(1, 0.05));
	    container.add(form);
	}

	@Override
	public Widget asWidget() {
		return container;
	}

	@Override
	public void setPresenter(IEastPresenter presenter) {
		this.presenter = presenter;		
	}

	@Override
	public IEastPresenter getPresenter() {
		return this.presenter;
	}
	

}
